﻿using Project.API;
using Project.BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace Project.Api.Controllers
{
    public class GoodsTypeController : ApiController
    {
        // GET: api/GoodType
        public ResultData<List<GoodTypeDto>> Get()
        {
            var data = new GoodsTypeBll().Query();
            ResultData<List<GoodTypeDto>> result = new ResultData<List<GoodTypeDto>>();
            List<GoodTypeDto> list = new List<GoodTypeDto>();
            foreach (var item in data)
            {
                list.Add(new GoodTypeDto() { 
                    GTID=item.gtId,
                    Name=item.name,
                    Icon=item.icon,
                    Is_Show_Backstage=item.is_show_backstage,
                    Sort = item.sort
                });
            }

            result.code = 1;
            result.msg = "ok";
            result.data = list;

            return result;
        }

        // GET: api/GoodType/5
        public string Get(int id)
        {
            return "value";
        }

        // POST: api/GoodType
        public void Post([FromBody]string value)
        {
        }

        // PUT: api/GoodType/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE: api/GoodType/5
        public void Delete(int id)
        {
        }
    }
}
